1. Establishing a database connection
Copy CodeThe code is as follows:
$mysqli = new Mysqli ("localhost", "root", "" "," mydb ");
?>
Establishing a database connection requires four parameters, namely the database address, the database access
1. Establish a database connection Copy codeThe Code is as follows:$ Mysqli = new mysqli ("localhost", "root", "", "mydb ");?> To establish a database connection, four parameters are required: Database address, database access username, database
1. Establish a database connection
Copy codeThe Code is as follows: $ Mysqli = new mysqli ("localhost", "root", "", "mydb ");
?>
To establish a database connection, four parameters are required: Database address, database access username, database
PHP 5 operates the basic MySQL database code, so remember, thanks a few times, even getting started with database operations. You can learn some string processing methods later or later.
1. establish a database connection
The code is as follows:
In fact, there is no desire today. -mysqli, Desire. -mysqli
Hi
Noon Shuangshuang Swim for a while, but the afternoon to a punch Superman read, unexpectedly sprout not out of the desire to learn ... Force yourself to update something, read a book.
1,
PHP supports MySQL in the early stages, and in its 2nd edition it contains an API. Because the combination is too common, the extension is turned on by default. However, PHP 5 released an updated MySQL extension, called MySQL improved, abbreviated
MySQL I extension of PHP5 is usually used in combination with mysql databases for application systems built using PHP. for a long time, MySQL extension has been accompanied by PHP and MySQL, and provides a channel for interaction between the two.
MYSQLI provides an object-oriented and process-oriented approach to interacting with the database, looking at both of these ways.
1. Object Oriented
In the object-oriented approach, MYSQLI is encapsulated into a class that is constructed as
Access to the database to implement additions and deletions and changes in the page display slightly dynamic application:Add Data:Main side: main.php$db = new Mysqli ("localhost", "root", "" "," mydb ");!mysqli_connect_error () or Die ("Connection
In recent days, we have been learning to use MYSQLI to access the database and manipulate the data in it. Today to show you a complete example, we have to create a press release system, using MYSQLI to operate the database, to add to the news,
PHP Configuration
Referencing mysqli extensions
Extension = Php_mysqli.dll
No absolute path required
If not enabled, then the reference mysqli extension must use an absolute path referenceExtension_dir = "ext"Creating and
Home: Home Code name Sex ethnic Birthdays $db = new Mysqli ("localhost", "root", "" "," mydb ");!mysqli_connect_error () or Die ("Connection failed! ");$sql = "SELECT * from Info";$result = $db->query ($sql);if ($result){$attr =
Home: Home Code name Sex ethnic Birthdays $db = new Mysqli ("localhost", "root", "" "," mydb ");!mysqli_connect_error () or Die ("Connection failed! ");$sql = "SELECT * from Info";$result = $db->query ($sql);if ($result){$attr =
1. Differences from mysql extension libraries: (1) higher security and stability (2) providing object-oriented and process-oriented styles 2. php. extensionphp_mysqli.dll in ini unseal 3. Object-oriented: Query List 1? Php23mysqli operation data
PHP5 operates on the MySQL database. 1. create a database connection? Php $ mysqlinewmysqli (localhost, root, mydb );? To establish a database connection, four parameters are required: database address, database access username, and data. 1. create
: This article mainly introduces the use of PHP and MySQL. if you are interested in the PHP Tutorial, you can refer to it. PHP supports MySQL at the early stage. in its 2nd version, it contains an API. Because the combination of the two is too
Using PHP to Access databases built by MySQLConnecting to a database1. Build Connection Object $db = new mysqli ("localhost", "root", "123", "text"),//2. Determine if the connection is wrong if (Mysqli_connect_error ()) {die ("Connection failed! ");}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.